/// @tags: NTT
#include <algorithm>
#include <cctype>
#include <cstdio>

typedef unsigned long long ull;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

constexpr int N = 3e6, mod = 998244353, G = 3, invG = 332748118;
int n, m, maxl = 1, lim, cvt[N], f[N], g[N];

inline int qpow(ull base, int exp) {
  ull res = 1;
  while (exp) {
    if (exp & 1) res = res * base % mod;
    base = base * base % mod;
    exp >>= 1;
  }
  return res;
}

inline void NTT(int *const A, bool typ) {
  for (int i = 0; i < maxl; ++i)
    if (i < cvt[i]) std::swap(A[i], A[cvt[i]]);
  for (int i = 2; i <= maxl; i <<= 1) {
    int mid = i >> 1, wn = qpow(typ ? G : invG, (mod - 1) / i);
    for (int j = 0; j < maxl; j += i) {
      ull wk = 1, t;
      for (int k = 0; k < mid; ++k, wk = (wk * wn) % mod) {
        t = wk * A[j + k + mid] % mod;
        if ((A[j + k + mid] = A[j + k] - t) < 0) A[j + k + mid] += mod;
        if ((A[j + k] += t) >= mod) A[j + k] -= mod;
      }
    }
  }
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen64("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen64("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("NTT.in", "r", stdin);
  freopen("NTT.out", "w", stdout);
#endif
#endif

  read(n), read(m);
  for (int i = 0; i <= n; ++i) read(f[i]);
  for (int i = 0; i <= m; ++i) read(g[i]);

  while (maxl < n + m + 1) maxl <<= 1, ++lim;
  for (int i = 0; i < maxl; ++i)
    cvt[i] = (cvt[i >> 1] >> 1 | ((i & 1) << (lim - 1)));

  NTT(f, true), NTT(g, true);
  for (int i = 0; i < maxl; ++i) f[i] = static_cast<ull>(f[i]) * g[i] % mod;
  NTT(f, false);

  ull inv = qpow(maxl, mod - 2);
  for (int i = 0; i <= n + m; ++i)
    printf("%d ", static_cast<int>(inv * f[i] % mod));
  return 0;
}